// import com.alibaba.druid.DbType;
// import com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock*;
// import com.alibaba.druid.support.logging.Log;
// import com.alibaba.druid.support.logging.LogFactory;
// import com.alibaba.druid.util.FnvHash;

// import java.util.std::list;
// import java.util.concurrent.CopyOnWriteArrayList;
#pragma once
#include <string>
#include <list>
#include <memory>
#include "../../DbType.h"

class SQLSelectQueryBlock;
class Lexer;

class SQLSelectListCache
{
public:
  class Entry
  {
  public:
    string_ptr sql;
    SQLSelectQueryBlock *queryBlock;
    string_ptr printSql;
    long printSqlHash;

    Entry(string_ptr sql_, SQLSelectQueryBlock *queryBlock_, string_ptr printSql_, long printSqlHash_);
  };

private:
  // static Log LOG = LogFactory.getLog(SQLSelectListCache.class);
  DbType_ptr dbType;
  std::shared_ptr<std::list<std::shared_ptr<Entry>>> entries;

public:
  SQLSelectListCache(DbType_ptr dbType);

  void add(string_ptr select);

  int getSize();

  void clear();

  BOOL_ptr match(Lexer_ptr lexer, SQLSelectQueryBlock_ptr queryBlock);
};
